{% extends "./inc/base.html" %}
{% block style %}
<!--<link rel="stylesheet" href="/static/js/slider/slider.css" type="text/css" />-->
<link rel="stylesheet" href="/static/admin/js/chosen/chosen.css" type="text/css" />
<script src="/static/admin/js/jquery.min.js"></script>
{% endblock %}
{% block content %}
<section class="vbox">
    <header class="header bg-light dk">
        <p>{{controller.meta_title}}</p>

    </header>
    <section class="scrollable wrapper">

        <div class="row">

            <div class="col-lg-12">
                <section class="panel panel-default">
                    <header class="panel-heading text-right bg-light  clearfix">
                        {%if controller.get('mold')==2%}
                        <ul class="nav nav-tabs pull-left">
                            <li class="active"><a data-toggle="tab" href="#tab1">基础选项</a></li>
                            <li class=""><a data-toggle="tab" href="#tab2">模板设置</a></li>
                            <li class=""><a data-toggle="tab" href="#tab3">SEO设置</a></li>
                            <li class=""><a data-toggle="tab" href="#tab4">权限设置</a></li>
                        </ul>
                        {%else%}
                        <ul class="nav nav-tabs pull-left">
                            <li class="active"><a data-toggle="tab" href="#tab1">基础选项</a></li>
                            <li class=""><a data-toggle="tab" href="#tab3">SEO设置</a></li>
                            {%if controller.get('mold')!=1%}
                            <li class=""><a data-toggle="tab" href="#tab2">模板设置</a></li>
                            <li class=""><a data-toggle="tab" href="#tab4">栏目分组</a></li>
                            <li class=""><a data-toggle="tab" href="#tab5">分类信息</a></li>
                            <li class=""><a data-toggle="tab" href="#tab6">权限设置</a></li>
                            <li class=""><a data-toggle="tab" href="#tab7">收费设置</a></li>
                            {%endif%}
                        </ul>
                        {%endif%}
                        <span class="hidden-sm">Left</span>
                    </header>
                    <div class="panel-body">
                        {%if controller.get('mold')==2%}
                        <form action="{{controller.action}}" class="form-horizontal" method="post"  data-validate="parsley">
                        <div class="tab-content">

                            <div id="tab1" class="tab-pane fade active in">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><i class="fa fa-asterisk text-danger"></i> 上级栏目</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                        <div class="col-md-3">
                                        <select class="form-control" name="pid" id="pid">
                                        </select>
                                        </div>
                                            <div class="col-md-12 hide">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 上级分类.</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><i class="fa fa-asterisk text-danger"></i> 栏目名称</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                        <div class="col-md-3"><input name="title" type="text" class="form-control" data-required="true"></div>
                                            <div class="col-md-12 hide">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 名称不能为空.</span>
                                        </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">栏目标识</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                        <div class="col-md-3"><input name="name" type="text" class="form-control"></div>
                                            <div class="col-md-12">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 非必填，填写后，此名称会替换url中的栏目id,英文字母.不能重复。</span>
                                        </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">栏目图标</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                            <div class="col-sm-10">
                                          {{HOOKS@adminUpPic.icon|safe}}
                                        </div>
                                            <div class="col-md-12 hide">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 图片上传</span>
                                            </div>
                                        </div>


                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">可见性</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                            <div class="col-md-10">
                                                <label class="radio-inline i-checks">
                                                    <input type="radio"  value="1" name="display" checked=""><i></i> 所有人可见
                                                </label>
                                                <label class="radio-inline i-checks">
                                                    <input type="radio"   value="0" name="display"><i></i> 不可见
                                                </label>
                                                <label class="radio-inline i-checks">
                                                    <input type="radio"    value="2" name="display"><i></i> 管理员可见
                                                </label>
                                            </div>
                                            <div class="col-md-12">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 是否对用户可见，针对前台</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">排序</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                            <div class="col-md-2"><input name="sort" value="0" type="text" class="form-control"></div>
                                            <div class="col-md-12">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 仅对当前层级分类有效</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>

                            </div>
                            <div id="tab2" class="tab-pane fade ">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">PC单页模板</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                            <div class="col-md-5">
                                                <select style="width:260px" name="template_index" class="chosen-select">
                                                    <optgroup label="默认">
                                                        <option value="">默认单页模版</option>
                                                    </optgroup>
                                                    <optgroup label="自定义模版">
                                                        {% for v in temp_pc.template_sp%}
                                                        {%if v.action != 'index'%}
                                                        <option value="{{v.action}}">{{v.name}}[{{v.action}}]</option>
                                                        {%endif%}
                                                        {% endfor%}
                                                    </optgroup>
                                                    <optgroup label="管理">
                                                        <option data-url="/admin/template/sp" class="addtemp">添加单页模板</option>
                                                    </optgroup>

                                                </select>
                                            </div>
                                            <div class="col-md-12">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 栏目单页PC端模板</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">手机单页模板</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                            <div class="col-md-5">
                                                <select style="width:260px" name="template_m_index" class="chosen-select">
                                                    <optgroup label="默认">
                                                        <option value="">默认手机单页模版</option>
                                                    </optgroup>
                                                    <optgroup label="自定义模版">
                                                        {% for v in temp_m.template_sp%}
                                                        {%if v.action != 'index'%}
                                                        <option value="{{v.action}}" >{{v.name}}[{{v.action}}]</option>
                                                        {%endif%}
                                                        {% endfor%}
                                                    </optgroup>
                                                    <optgroup label="管理">
                                                        <option data-url="/admin/template/sp/?type=2" class="addtemp">添加手机单页模板</option>
                                                    </optgroup>

                                                </select>
                                            </div>
                                            <div class="col-md-12">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 手机端单页模板</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div id="tab3" class="tab-pane fade ">

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">META Title（栏目标题）</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                            <div class="col-md-5"><input name="meta_title"  type="text" class="form-control" name=""></div>
                                            <div class="col-md-12">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 针对搜索引擎设置的标题</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">META Keywords（栏目关键词）</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                            <div class="col-md-5">
                                                <textarea class="form-control" name="keywords"></textarea></div>
                                            <div class="col-md-12">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 关键字中间用半角逗号隔开</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">META Description（栏目描述）</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                            <div class="col-md-5">
                                                <textarea name="description" class="form-control" ></textarea></div>
                                            <div class="col-md-12">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 针对搜索引擎设置的网页描述</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>

                            </div>
                            <div id="tab4" class="tab-pane fade ">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">角色权限</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                            <div class="col-md-12"><table class="table table-hover m-b-none">
                                                <thead>
                                                <tr class="bg-light">
                                                    <th>角色名称</th>
                                                    {% for index, items in config.setup.SP_PRIV_ROLE %}
                                                    <th>{{items}}</th>
                                                    {% endfor%}
                                                </tr>
                                                </thead>
                                                <tbody>
                                                {%for val in role%}
                                                <tr>
                                                    <td>
                                                        {{val.desc}}
                                                    </td>
                                                    {% for index, items in config.setup.SP_PRIV_ROLE %}
                                                    <td>
                                                        <label class="checkbox m-n i-checks"><input  type="checkbox" name="priv_roleid" value="{{index}},{{val.id}}" ><i></i></label>
                                                    </td>
                                                    {% endfor%}

                                                </tr>
                                                {%endfor%}
                                                </tbody>
                                            </table></div>
                                            <div class="col-md-12">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 选中时才会生效，当全部不选时，表示全部组不进行权限控制</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">会员组权限</label>
                                    <div class="col-sm-10">
                                        <div class="row">
                                            <div class="col-md-12"><table class="table table-hover m-b-none">
                                                <thead>
                                                <tr class="bg-light">
                                                    <th>会员组名称</th>
                                                    <th>允许访问</th>

                                                </tr>
                                                </thead>
                                                <tbody>
                                                {%for val in group%}
                                                <tr>
                                                    <td>
                                                        <span style="color:{{val.usernamecolor}}">{{val.name}}</span>
                                                    </td>
                                                    <td>
                                                        <label class="checkbox m-n i-checks"><input  type="checkbox" name="priv_groupid" value="visit,{{val.groupid}}" ><i></i></label>
                                                   </td>
                                                </tr>
                                                {%endfor%}
                                                </tbody>
                                            </table></div>
                                            <div class="col-md-12">
                                                <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 选中时才会生效，当全部不选时，表示全部组不进行权限控制</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="line line-dashed b-b line-lg pull-in"></div>
                            </div>
                        </div>
                            <div class="form-group form-submit">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <input type="hidden" name="mold" value="2">
                                    <button type="submit" target-form="form-horizontal" class="btn btn-primary ajax-post">保存</button>
                                    <button type="submit" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返回</button>
                                </div>
                            </div>
                        </form>
                        {%else%}
                        <form action="{{controller.action}}" class="form-horizontal" method="post"  data-validate="parsley">
                            <div class="tab-content">

                                <div id="tab1" class="tab-pane fade active in">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label"><i class="fa fa-asterisk text-danger"></i> 绑定模型</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-10">
                                                    {% for list in models %}
                                                    <label class="{%if controller.get('mold')==1%}radio-inline{%else%}checkbox-inline{%endif%} i-checks">
                                                        <input type="{%if controller.get('mold')==1%}radio{%else%}checkbox{%endif%}" value="{{list.id}}" name="model"><i></i> {{list.title}}
                                                    </label>
                                                    {% endfor %}
                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 注意，如没有特殊需求，建议每个栏目只绑定一个模型。</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label"><i class="fa fa-asterisk text-danger"></i> 上级栏目</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-3">
                                                    <select class="form-control" name="pid" id="pid">
                                                    </select>
                                                </div>
                                                <div class="col-md-12 hide">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 上级分类.</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label"><i class="fa fa-asterisk text-danger"></i> 栏目名称</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-3"><input name="title" type="text" class="form-control" data-required="true"></div>
                                                <div class="col-md-12 hide">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 名称不能为空.</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">栏目标识</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-3"><input name="name" type="text" class="form-control"></div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 非必填，填写后，此名称会替换url中的栏目id,英文字母.不能重复。</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">栏目类型</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-10">
                                                    <label class="radio-inline i-checks">
                                                        <input type="radio" value="0" name="allow_publish"><i></i> 封面
                                                    </label>
                                                    <label class="radio-inline i-checks">
                                                        <input type="radio"  value="1" checked="checked" name="allow_publish"><i></i> 列表
                                                    </label>
                                                    <!--<label class="radio-inline i-checks">-->
                                                        <!--<input type="radio"  value="2" name="allow_publish"><i></i> 允许前后台-->
                                                    <!--</label>-->
                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 封面：不能发布信息，可以作为栏目的首页。</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">入库前是否审核</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-10">
                                                    <label class="radio-inline i-checks">
                                                        <input type="radio"  value="0" name="check" checked><i></i> 不需要
                                                    </label>
                                                    <label class="radio-inline i-checks">
                                                        <input type="radio"  value="1" name="check"><i></i> 需要
                                                    </label>
                                                </div>
                                                <div class="col-md-12 ">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 这个审核是信息入库前最后的审核，一般默认 不需要 即可。</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    {%if controller.get('mold')!=1%}
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label"><i class="fa fa-asterisk text-danger"></i> 允许文档类型</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-10">
                                                    {% for key , val in config.document_model_type %}
                                                    <label class="checkbox-inline i-checks">
                                                        <input type="checkbox"  value="{{key}}" name="type" ><i></i> {{val}}
                                                    </label>
                                                    {% endfor%}
                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 至少选择勾选一项。</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">子文档绑定绑定模型</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-10">
                                                    {% for list in models %}
                                                    <label class="checkbox-inline i-checks">
                                                        <input type="checkbox"   value="{{list.id}}" name="model_sub"><i></i> {{list.title}}
                                                    </label>
                                                    {% endfor %}

                                                </div>
                                                <div class="col-md-12 hide">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 子文档支持发布的文档模型</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    {%endif%}
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">栏目图标</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-sm-10">
                                                    {{HOOKS@adminUpPic.icon|safe}}
                                                </div>
                                                <div class="col-md-12 hide">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 图片上传</span>
                                                </div>
                                            </div>


                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">可见性</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-10">
                                                    <label class="radio-inline i-checks">
                                                        <input type="radio"  value="1" name="display" checked=""><i></i> 所有人可见
                                                    </label>
                                                    <label class="radio-inline i-checks">
                                                        <input type="radio"   value="0" name="display"><i></i> 不可见
                                                    </label>
                                                    <label class="radio-inline i-checks">
                                                        <input type="radio"    value="2" name="display"><i></i> 管理员可见
                                                    </label>
                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 是否对用户可见，针对前台</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">排序</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-2"><input name="sort" value="0" type="text" class="form-control"></div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 仅对当前层级分类有效</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>

                                </div>
                                <div id="tab3" class="tab-pane fade ">

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">META Title（栏目标题）</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5"><input name="meta_title"  type="text" class="form-control" value=""></div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 针对搜索引擎设置的标题</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">META Keywords（栏目关键词）</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5">
                                                    <textarea class="form-control" name="keywords"></textarea></div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 关键字中间用半角逗号隔开</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">META Description（栏目描述）</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5">
                                                    <textarea name="description" class="form-control" ></textarea></div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 针对搜索引擎设置的网页描述</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>

                                </div>
                                {%if controller.get('mold')!=1%}
                                <div id="tab2" class="tab-pane fade ">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">频道模板</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5">
                                                    <select style="width:260px" name="template_index" class="chosen-select">
                                                        <optgroup label="默认">
                                                            <option value="">默认频道模版</option>
                                                        </optgroup>
                                                        <optgroup label="自定义模版">
                                                            {% for v in temp_pc.template_index%}
                                                            <option value="{{v.action}}">{{v.name}}[{{v.action}}]</option>
                                                            {% endfor%}
                                                        </optgroup>
                                                        <optgroup label="管理">
                                                            <option data-url="/admin/template/channel" class="addtemp">添加频道模版</option>
                                                        </optgroup>

                                                    </select>
                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 栏目的首页模板</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">列表模板</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5">

                                                    <select style="width:260px" name="template_lists" class="chosen-select">
                                                        <optgroup label="默认">
                                                            <option value="">默认列表模版</option>
                                                        </optgroup>
                                                        <optgroup label="自定义模版">
                                                            {% for v in temp_pc.template_lists%}
                                                            <option value="{{v.action}}">{{v.name}}[{{v.action}}]</option>
                                                            {% endfor%}
                                                        </optgroup>
                                                        <optgroup label="管理">
                                                            <option data-url="/admin/template/column" class="addtemp">添加列表模版</option>
                                                        </optgroup>

                                                    </select>
                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 栏目的列表页模板</span>
                                                </div></div>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">详情模板</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5">
                                                    <select style="width:260px" name="template_detail" class="chosen-select">
                                                        <optgroup label="默认">
                                                            <option value="">默认详情模版</option>
                                                        </optgroup>
                                                        <optgroup label="自定义模版">
                                                            {% for v in temp_pc.template_detail%}
                                                            <option value="{{v.action}}">{{v.name}}[{{v.action}}]</option>
                                                            {% endfor%}
                                                        </optgroup>
                                                        <optgroup label="管理">
                                                            <option data-url="/admin/template/detail" class="addtemp">添加详情模版</option>
                                                        </optgroup>

                                                    </select>
                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 栏目的内容页模板</span>
                                                </div></div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">手机频道模板</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5">
                                                    <select style="width:260px" name="template_m_index" class="chosen-select">
                                                        <optgroup label="默认">
                                                            <option value="">默认手机频道模版</option>
                                                        </optgroup>
                                                        <optgroup label="自定义模版">
                                                            {% for v in temp_m.template_index%}
                                                            <option value="{{v.action}}">{{v.name}}[{{v.action}}]</option>
                                                            {% endfor%}
                                                        </optgroup>
                                                        <optgroup label="管理">
                                                            <option data-url="/admin/template/channel/type/2" class="addtemp">添加手机频道模版</option>
                                                        </optgroup>

                                                    </select>
                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 手机端栏目的首页模板</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">手机列表模板</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5">

                                                    <select style="width:260px" name="template_m_lists" class="chosen-select">
                                                        <optgroup label="默认">
                                                            <option value="">默认手机列表模版</option>
                                                        </optgroup>
                                                        <optgroup label="自定义模版">
                                                            {% for v in temp_m.template_lists%}
                                                            <option value="{{v.action}}">{{v.name}}[{{v.action}}]</option>
                                                            {% endfor%}
                                                        </optgroup>
                                                        <optgroup label="管理">
                                                            <option data-url="/admin/template/column／type/2" class="addtemp">添加手机列表模版</option>
                                                        </optgroup>

                                                    </select>
                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 栏目的手机列表页模板</span>
                                                </div></div>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">手机详情模板</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5">
                                                    <select style="width:260px" name="template_m_detail" class="chosen-select">
                                                        <optgroup label="默认">
                                                            <option value="">默认手机详情模版</option>
                                                        </optgroup>
                                                        <optgroup label="自定义模版">
                                                            {% for v in temp_m.template_detail%}
                                                            <option value="{{v.action}}">{{v.name}}[{{v.action}}]</option>
                                                            {% endfor%}
                                                        </optgroup>
                                                        <optgroup label="管理">
                                                            <option data-url="/admin/template/detail/type/2" class="addtemp">添加手机详情模版</option>
                                                        </optgroup>

                                                    </select>
                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 栏目的手机内容页模板</span>
                                                </div></div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">编辑模板</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5"><input name="template_edit"  type="text" class="form-control"></div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 编辑页面模板</span>
                                                </div></div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">列表行数</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-2"><input name="list_row"  type="text" value="10" class="form-control"></div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 前台列表每页显示的条数</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                </div>
                                <div id="tab4" class="tab-pane fade ">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">分组定义</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-5"><textarea name="groups"  class="form-control" placeholder="索引:分组名称" style="height: 300px"></textarea></div>
                                                <div class="col-md-12">
                                               <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i>
只在填写分组时有效，每行一个分组，<code>:</code>前面为字段<code>索引</code>(建议用数字)，后面为<code>分组名称</code>，例如: <br>
<pre>1:分组一
2:分组二
3:分组三</pre>
<code>注意: 分组确定后请勿修改索引和分组名称的对应关系，但仍可以新增字段。如需调换显示顺序，可以通过移动整行的上下位置来实现</code>
</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                </div>
                                <div id="tab5" class="tab-pane fade ">
                                    <input type="hidden" name="documentsorts" value="">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">启用分类信息</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-10">
                                                    <label class="radio-inline i-checks">
                                                        <input type="radio"  value="1" name="documentsorts[status]"><i></i> 是
                                                    </label>
                                                    <label class="radio-inline i-checks">
                                                        <input type="radio"   value="0" name="documentsorts[status]" checked=""><i></i> 否
                                                    </label>

                                                </div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 以下设置没有继承性，即仅对当前栏目有效，不会对下级子栏目产生影响。</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div id="documentsortscon" style="display:none;">
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">发布必须归类</label>
                                            <div class="col-sm-10">
                                                <div class="row">
                                                    <div class="col-md-10">  <label class="radio-inline i-checks">
                                                        <input type="radio"  value="1" name="documentsorts[required]"><i></i> 是
                                                    </label>
                                                        <label class="radio-inline i-checks">
                                                            <input type="radio"   value="0" name="documentsorts[required]" checked=""><i></i> 否
                                                        </label></div>
                                                    <div class="col-md-12">
                                                        <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 是否强制用户发表新内容时必须选择分类</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="line line-dashed b-b line-lg pull-in"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">类别前缀</label>
                                            <div class="col-sm-10">
                                                <div class="row">
                                                    <div class="col-md-10">  <label class="radio-inline i-checks">
                                                        <input type="radio"  value="1" name="documentsorts[prefix]"><i></i> 是
                                                    </label>
                                                        <label class="radio-inline i-checks">
                                                            <input type="radio"   value="0" name="documentsorts[prefix]" checked=""><i></i> 否
                                                        </label></div>
                                                    <div class="col-md-12">
                                                        <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 是否在主题前面显示分类的名称</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="line line-dashed b-b line-lg pull-in"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">启用默认显示分类</label>
                                            <div class="col-sm-10">
                                                <div class="row">
                                                    <div class="col-md-10">  <label class="radio-inline i-checks">
                                                        <input type="radio"  value="1" name="documentsorts[default]"><i></i> 是
                                                    </label>
                                                        <label class="radio-inline i-checks">
                                                            <input type="radio"   value="0" name="documentsorts[default]" checked=""><i></i> 否
                                                        </label></div>
                                                    <div class="col-md-12">
                                                        <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 是否启用默认显示分类，如果启用请在下面的分类信息里面选择</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="line line-dashed b-b line-lg pull-in"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">选择分类</label>
                                            <div class="col-sm-10">
                                                <div class="row">
                                                    <div class="col-md-10">
                                                        <table class="table table-striped m-b-none" id="typelist">
                                                            <thead>
                                                            <tr>
                                                                <th style="width: 70px;">启用</th>
                                                                <th>分类名称</th>
                                                                <th>分类说明</th>
                                                                <th style="width: 150px;">发布菜单中显示</th>
                                                                <th style="width: 150px;">默认显示分类</th>
                                                            </tr>
                                                            </thead>
                                                            <tbody>
                                                            {%for val in typelist%}
                                                            <tr>
                                                                <td>
                                                                    <label class="checkbox i-checks" style="padding-top: 0;"><input type="checkbox" name="documentsorts[options][enable]" value="{{val.typeid}}" class="enable" ><i></i></label>
                                                                </td>
                                                                <td>{{val.name}}</td>
                                                                <td>{{val.description}}</td>
                                                                <td class="text-success">
                                                                    <label class="checkbox i-checks" style="padding-top: 0;"><input type="checkbox" name="documentsorts[options][show]" value="1" class="show"><i></i></label>
                                                                </td>
                                                                <td class="text-success">
                                                                    <label class="checkbox i-checks" style="padding-top: 0;"><input type="radio" name="documentsorts[defaultshow]" value="{{val.typeid}}" class="defaultshow"><i></i></label>
                                                                </td>

                                                            </tr>
                                                            {%endfor%}
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                    <div class="col-md-12">
                                                        <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 关键字</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="line line-dashed b-b line-lg pull-in"></div>
                                    </div>
                                </div>
                                <div id="tab6" class="tab-pane fade ">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">角色权限</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-12"><table class="table table-hover m-b-none">
                                                    <thead>
                                                    <tr class="bg-light">
                                                        <th>角色名称</th>
                                                        {% for index, items in config.setup.SYS_PRIV_ROLE %}
                                                        <th>{{items}}</th>
                                                        {% endfor%}
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    {%for val in role%}
                                                    <tr>
                                                        <td>
                                                            {{val.desc}}
                                                        </td>
                                                        {% for index, items in config.setup.SYS_PRIV_ROLE %}
                                                        <td>
                                                            <label class="checkbox m-n i-checks"><input  type="checkbox" name="priv_roleid" value="{{index}},{{val.id}}" ><i></i></label>
                                                        </td>
                                                        {% endfor%}

                                                    </tr>
                                                    {%endfor%}
                                                    </tbody>
                                                </table></div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 选中时才会生效，当全部不选时，表示全部组不进行权限控制</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">会员组权限</label>
                                        <div class="col-sm-10">
                                            <div class="row">
                                                <div class="col-md-12"><table class="table table-hover m-b-none">
                                                    <thead>
                                                    <tr class="bg-light">
                                                        <th>会员组名称</th>
                                                        {% for index, items in config.setup.SYS_PRIV_GROUP %}
                                                        <th>{{items}}</th>
                                                        {% endfor%}

                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    {%for val in group%}
                                                    <tr>
                                                        <td>
                                                            <span style="color:{{val.usernamecolor}}">{{val.name}}</span>
                                                        </td>
                                                        {% for index, items in config.setup.SYS_PRIV_GROUP %}
                                                        <td>
                                                            <label class="checkbox m-n i-checks"><input  type="checkbox" name="priv_groupid" value="{{index}},{{val.groupid}}" ><i></i></label>
                                                        </td>
                                                        {% endfor%}
                                                    </tr>
                                                    {%endfor%}
                                                    </tbody>
                                                </table></div>
                                                <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 选中时才会生效，当全部不选时，表示全部组不进行权限控制</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="line line-dashed b-b line-lg pull-in"></div>
                                </div>
                                <div id="tab7" class="tab-pane fade ">
                                    6
                                </div>
                                {%endif%}
                            </div>
                            <div class="form-group form-submit">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <input type="hidden" name="mold" value="{{controller.get('mold')}}">
                                    <button type="submit" target-form="form-horizontal" class="btn btn-primary ajax-post">保存</button>
                                    <button type="submit" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返回</button>
                                </div>
                            </div>
                        </form>
                        {%endif%}
                    </div>
                </section>

            </div>

        </div>
    </section>
</section>

{% endblock %}

{% block script %}
<!-- slider -->
<!--<script src="/static/js/slider/bootstrap-slider.js"></script>-->
<!-- file input -->
<script src="/static/admin/js/chosen/chosen.jquery.min.js"></script>
<script src="/static/admin/js/file-input/bootstrap-filestyle.min.js"></script>
<script src="/static/admin/js/parsley/parsley.min.js"></script>
<script src="/static/admin/js/parsley/parsley.extend.js"></script>
<script type="text/javascript">
    $(function(){

        //获取上级菜单
        $.ajax({
            url: "/admin/category/gettree",
            data:{mold:'all'},
            success: function (msg) {
                /* 展示生成的HTML */
                $("#pid").html(category_to_html(msg));

            }
        })

        //添加
        function addtype() {
            var required = $('input[name="documentsorts[required]"]:checked').val();
            var prefix = $('input[name="documentsorts[prefix]"]:checked').val();
            var defaults = $('input[name="documentsorts[default]"]:checked').val();
            var defaultshow = $('input[name="documentsorts[defaultshow]"]:checked').val();
            var types = []
            $("#typelist>tbody>tr").each(function (k,v) {
                var obj = {}
                obj.enable=$(v).find("input[name='documentsorts[options][enable]']:checked").val()||0;
                obj.name = $(v).find("td").eq(1).text();
                obj.description = $(v).find("td").eq(2).text();
                obj.show = $(v).find("input[name='documentsorts[options][show]']:checked").val()||0;
                if(obj.enable!=0){
                    types.push(obj);
                }
            });
            var documentsorts = {
                required:required,
                prefix:prefix,
                default:defaults,
                defaultshow:defaultshow,
                types:types
            }
            $('input[name="documentsorts"]').val("");
            $('input[name="documentsorts"]').val(JSON.stringify(documentsorts));
        }

            $('.enable,.show,.defaultshow,[name="documentsorts[required]"],[name="documentsorts[prefix]"],[name="documentsorts[default]"]').on('change',function () {
                addtype()
            })

$('input[name="documentsorts[status]"]').click(function () {
    var val = $(this).val();
    if(val==1){
        $("#documentsortscon").show();
        addtype();
    }else {
        $("#documentsortscon").hide();
        $('input[name="documentsorts"]').val("");
    }
})
        /* 生成HTML ul/li 形式 */
        function category_to_html(nodes) {
            var html = [];
            var size = nodes.length;
            var left = null;
            var pid ="{{controller.get('pid')}}";
            html.push('<option value="0" selected="selected">一级菜单</option>');
            for (var i = 0; i < size; i++) {
                left = nodes[i];
                if(pid == left.id){
                    html.push('<option value="' + left['id'] +  '" selected="selected">'+new Array(left["deep"]+1).join("= ") + left['title'] +  '</option>');
                }else {
                    html.push('<option value="' + left['id'] + '">'+new Array(left["deep"]+1).join("= ") + left['title'] +  '</option>');
                }
            }
            return html.join("\n");
        }
        $(".addtemp").click(function () {
            var href=$(this).attr("id");
             var id = "#"+href.split("_")[0];
             var url = $(id).find(".addtemp").attr("data-url");
            window.location.href=url;
        })
    })
</script>
{% endblock %}